//ZMCN50模块主表查询和点击页签记录后刷新主表数据回调函数
var CN50_callback= {
		onSuccess: function(eiInfo) { 
			//账上库存总量
			var obj=$("#result-fdStockValue");
			if(typeof(obj.val()=="undefined")){
				obj=$("#result-fdStockValue",window.parent.document);
			}
			obj.val(eiInfo.getBlock('result').getCell(0,"fdStockValue"));
			//煤坪总量
			obj=$("#result-fdStockACtual");
			if(typeof(obj.val()=="undefined")){
				obj=$("#result-fdStockACtual",window.parent.document);
			}
			obj.val(eiInfo.getBlock('result').getCell(0,"fdStockACtual"));
			//外购总量
			obj=$("#result-fdStockIn");
			if(typeof(obj.val()=="undefined")){
				obj=$("#result-fdStockIn",window.parent.document);
			}
			obj.val(eiInfo.getBlock('result').getCell(0,"fdStockIn"));
			//猫儿沱总库存
			obj=$("#result-fdStockMaoertuo");
			if(typeof(obj.val()=="undefined")){
				obj=$("#result-fdStockMaoertuo",window.parent.document);
			}
			obj.val(eiInfo.getBlock('result').getCell(0,"fdStockMaoertuo"));
		},
		onFail:function(eMsg)
		{
			EFAlert("库存汇总查询失败，原因："+eMsg); 
		}
	}
//ZMCN50模块，从表页签点击记录时刷新主表上的各种量
efgrid_onRowClicked = function( grid_id, row_index ){
	if(grid_id == "ef_grid_r"){ 
		var grid = efgrid.getGridObject(grid_id);
		var fdCurrentDate=grid.getCellValueByColumnName(row_index,"fdCurrentDate");
		//隐藏/显示从表按钮 
		var info = new EiInfo();
		info.set("fdCurrentDate",fdCurrentDate); 
		EiCommunicator.send("ZMCN50", "query", info, CN50_callback);  
	}
}
//计算差值
function calculate(a,b){
	if (a != null && a != "" && b != null && b != "") {
		return a-b;
	}else return 0;
}
//计算发热量 将MJ/kg转换为kcal/kg
function calculate(a){
	if(a!=null && a!=""){
		return (a/4.1816).toFixed(0);
	}
	return 0;
}